﻿'******************************************************
'******************************************************
'Application Title: Google Widget Editor
'version: 1.0
'Date: 01-02-2008
'Requirements: win2k or later
'Author: Andrew Pye
'Author Email: StretchMasterP@googlemail.com
'License: Released under GNU GENERAL PUBLIC LICENSE v3
'ToDo:
'Changes:Imports System.Text
'******************************************************
'******************************************************


Public Class Output

    Public Sub SetOutput(ByVal Code As String)
        Me.rtbOutput.Text = Code
    End Sub

    Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click
        Me.rtbOutput.Copy()
    End Sub

    Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click
        Me.rtbOutput.Paste()
    End Sub

    Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click
        Me.rtbOutput.Cut()
    End Sub

    Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllToolStripMenuItem.Click
        Me.rtbOutput.SelectAll()
    End Sub

    Private Sub SaveToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripButton.Click
        Dim SaveObject As New SaveFileDialog
        Dim FileName As String = ""
        Try
            With SaveObject

                .Filter = "Xml File (*.Xml)|*.Xml"

                .InitialDirectory = My.Settings.LAST_OPEN_PATH
                If .ShowDialog() = DialogResult.OK Then
                    FileName = .FileName
                    .AddExtension = True
                    Me.rtbOutput.SaveFile(FileName, RichTextBoxStreamType.PlainText)
                End If
            End With
        Catch es As Exception
            MessageBox.Show(es.Message)
        Finally

        End Try

    End Sub
    Private Sub CopyToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripButton.Click
        Me.rtbOutput.SelectAll()
        Me.rtbOutput.Copy()
    End Sub
End Class